﻿// ====================================================================
//  Texy.net - XML-RPC client for Texy! formatter
//  (c) 2006 Aleš Roubíček - Creative Commons 2.5 License
// --------------------------------------------------------------------
//  version: 1.0 RC2
// ====================================================================

using System;
using System.Configuration;

namespace Rarous.TexyNet.Configuration
{
    /// <summary>
    /// 
    /// </summary>
    public class LinkModuleElement : ConfigurationElement
    {
        #region Constructors
        /// <summary>
        /// Konstruktor
        /// </summary>
        public LinkModuleElement()
        { }
        #endregion

        #region Properties
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty("allowedLink", IsRequired = false, DefaultValue = true)]
        public bool AllowedLink
        {
            get { return Convert.ToBoolean(this["allowedLink"]); }
            set { this["allowedLink"] = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty("allowedEmail", IsRequired = false, DefaultValue = true)]
        public bool AllowedEmail
        {
            get { return Convert.ToBoolean(this["allowedEmail"]); }
            set { this["allowedEmail"] = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty("allowedUrl", IsRequired = false, DefaultValue = true)]
        public bool AllowedUrl
        {
            get { return Convert.ToBoolean(this["allowedUrl"]); }
            set { this["allowedUrl"] = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty("allowedQuickLink", IsRequired = false, DefaultValue = true)]
        public bool AllowedQuickLink
        {
            get { return Convert.ToBoolean(this["allowedQuickLink"]); }
            set { this["allowedQuickLink"] = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty("allowedReferences", IsRequired = false, DefaultValue = true)]
        public bool AllowedReferences
        {
            get { return Convert.ToBoolean(this["allowedReferences"]); }
            set { this["allowedReferences"] = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty("root", IsRequired = false, DefaultValue = "")]
        public string Root
        {
            get { return this["root"].ToString(); }
            set { this["root"] = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty("emailOnClick", IsRequired = false, DefaultValue = "")]
        public string EmailOnClick
        {
            get { return this["emailOnClick"].ToString(); }
            set { this["emailOnClick"] = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty("imageOnClick", IsRequired = false, DefaultValue = "")]
        public string ImageOnClick
        {
            get { return this["imageOnClick"].ToString(); }
            set { this["imageOnClick"] = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty("popupOnClick", IsRequired = false, DefaultValue = "")]
        public string PopupOnClick
        {
            get { return this["popupOnClick"].ToString(); }
            set { this["popupOnClick"] = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty("forceNoFollow", IsRequired = false, DefaultValue = false)]
        public bool ForceNoFollow
        {
            get { return Convert.ToBoolean(this["forceNoFollow"]); }
            set { this["forceNoFollow"] = value; }
        }
        #endregion

        #region Override Methods
        /// <summary>
        /// Nastavuje výchozí hodnoty
        /// </summary>
        protected override void InitializeDefault()
        {
            AllowedLink = true;
            AllowedEmail = true;
            AllowedQuickLink = true;
            AllowedReferences = true;
            AllowedUrl = true;
            Root = String.Empty;
            EmailOnClick = String.Empty;
            ImageOnClick = String.Empty;
            PopupOnClick = String.Empty;
            ForceNoFollow = false;
            base.InitializeDefault();
        }
        #endregion
    }
}
